package com.shj.utils;

import com.github.pagehelper.PageInfo;
import com.shj.model.PageRequest;
import com.shj.model.PageResult;

/**
 * @Description TODO 分页工具类
 * @Author songhuajian
 * @Date 2020/3/19 14:54
 **/
public class PageUtil {

    public static PageResult getPageResult(PageRequest pageRequest, PageInfo<?> pageInfo){
        PageResult pageResult = new PageResult();
        pageResult.setPageNum(pageInfo.getPageNum());
        pageResult.setPageSize(pageInfo.getPageSize());
        pageResult.setTotalSize(pageInfo.getTotal());
        pageResult.setTotalPages(pageInfo.getPages());
        pageResult.setContent(pageInfo.getList());
        return pageResult;
    }
}
